/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.server.database.engine.dml.controller;

import com.snail.server.database.engine.dml.dto.BatchDataDeleteDTO;
import com.snail.server.database.engine.dml.dto.BatchDataInsertDTO;
import com.snail.server.database.engine.dml.dto.BatchDataUpdateDTO;
import com.snail.server.database.engine.dml.manager.DMLBatchManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 *
 * @author zgadmin
 * @date 2025/9/8 17:10
 *
 */
@Api(tags = "数据定义管理(批次操作)")
@RestController
@RequestMapping("/ddl/data-source/{dataSourceId}/batch")
public class DDLBatchController {

    @Resource
    DMLBatchManager dmlBatchManager;

    @ApiOperation("批量-添加数据")
    @PostMapping
    public boolean insert(@PathVariable("dataSourceId") Long dataSourceId, @RequestBody BatchDataInsertDTO batchDataInsert){
        return dmlBatchManager.insert(dataSourceId, batchDataInsert);
    }

    @ApiOperation("批量-修改数据")
    @PutMapping
    public boolean update(@PathVariable("dataSourceId") Long dataSourceId, @RequestBody BatchDataUpdateDTO batchDataUpdate){
        return dmlBatchManager.update(dataSourceId, batchDataUpdate);
    }

    @ApiOperation("批量-删除数据")
    @DeleteMapping
    public boolean delete(@PathVariable("dataSourceId") Long dataSourceId, @RequestBody BatchDataDeleteDTO batchDataDelete){
        return dmlBatchManager.delete(dataSourceId, batchDataDelete);
    }

}